export default {
  createWorker(workerURL, params) {
    return new Promise((resolve, reject) => {
      const worker = new Worker(workerURL)
      worker.postMessage(params)
      worker.onmessage = (e) => {
        resolve(e.data)
      }
      worker.onerror = (e) => {
        reject(e)
      }
    })
  }
}
